package STX.entity;

import java.util.List;

public class Teacher extends Person {

    private String taught;

    public Teacher(int id, String name, String gender, String taught) {
        super(id, name, gender);
        this.taught = taught;
    }

    @Override
    public void printInfo() {
        super.printInfo();
        System.out.println("讲授课程：" + taught);
    }

    // 打印选课学生的方法（可选扩展）
    public void printStudents(List<Course> allCourses) {
        for (Course c : allCourses) {
            if (c.getTeacher() == this) {
                System.out.print("选课学生：");
                if (c.getStudents().isEmpty()) {
                    System.out.println("暂无学生选课");
                } else {
                    for (Student s : c.getStudents()) {
                        System.out.print(s.getName() + " ");
                    }
                    System.out.println();
                }
            }
        }
    }

    public String getTaught() { return taught; }
}
